//
//  GWHttpTool.m
//  新浪微博
//
//  Created by qianfeng on 16/2/17.
//  Copyright (c) 2016年 高炜. All rights reserved.
//

#import "GWHttpTool.h"
#import "AFHTTPRequestOperationManager.h"
@implementation GWHttpTool
+(void)get:(NSString *)url parameters:(NSDictionary *)parameters success:(void (^)(id))success failure:(void (^)(NSError *))failure
{
    AFHTTPRequestOperationManager *manager=[[AFHTTPRequestOperationManager alloc]init];
    
    [manager GET:url parameters:parameters success:^(AFHTTPRequestOperation *operation, NSDictionary* responseObject) {
        if (success) {
            success(responseObject);
        }
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        if (failure) {
            failure(error);
        }
    }];
}

+(void)post:(NSString *)url parameters:(NSDictionary *)parameters success:(void(^)(id respondObj   ))success failure:(void(^)(NSError *error))failure
{
    AFHTTPRequestOperationManager *manager=[[AFHTTPRequestOperationManager alloc]init];
    
    [manager POST:url parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
        if (success) {
            success(responseObject);
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
    
    
}


@end
